<?php
/**
 * Created by PhpStorm.
 * User: zhou
 * Date: 2019/3/26
 * Time: 上午12:30
 */

namespace App\Http\Controllers\Api\System;


use App\Http\Controllers\ApiController;
use App\Models\SystemConfig;
use Illuminate\Http\Request;

class SystemController extends ApiController
{
    /**
     * 获取配置列表
     */
    public function getconfig(Request $request,SystemConfig $systemConfig)
    {
        $list = SystemConfig::query()->get()->toArray();
        $tmp = [];
        foreach($list as $v){
            $tmp[$v['conf_key']] = $v[conf_val];
        }

        foreach($systemConfig->kye_list as $config_key){
            if(!array_key_exists($config_key,$tmp)){
                $tmp[$config_key] = '';
            }

        }
        return self::response($tmp);
    }
}